<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Actor</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Chapter 1. Phoenix 3.2.0">
<link rel="up" href="../index.html" title="Chapter 1. Phoenix 3.2.0">
<link rel="prev" href="organization.html" title="Organization">
<link rel="next" href="modules.html" title="Modules">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="organization.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="modules.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="phoenix.actor"></a><a class="link" href="actor.html" title="Actor">Actor</a>
</h2></div></div></div>
<p>
      The <code class="computeroutput"><span class="identifier">Actor</span></code> is the main concept
      behind the library. Actors are function objects. An actor can accept 0 to
      <code class="computeroutput"><span class="identifier">BOOST_PHOENIX_LIMIT</span></code> arguments.
    </p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
        You can set <code class="computeroutput"><span class="identifier">BOOST_PHOENIX_LIMIT</span></code>,
        the predefined maximum arity an actor can take. By default, <code class="computeroutput"><span class="identifier">BOOST_PHOENIX_LIMIT</span></code> is set to 10.
      </p></td></tr>
</table></div>
<p>
      Phoenix supplies an <code class="computeroutput"><span class="identifier">actor</span></code> class
      template whose specializations model the <code class="computeroutput"><span class="identifier">Actor</span></code>
      concept. <code class="computeroutput"><span class="identifier">actor</span></code> has one template
      parameter, <code class="computeroutput"><span class="identifier">Expr</span></code>, that supplies
      the underlying expression to evaluate.
    </p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Expr</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">actor</span>
<span class="special">{</span>
    <span class="identifier">return_type</span>
    <span class="keyword">operator</span><span class="special">()()</span> <span class="keyword">const</span><span class="special">;</span>

    <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T0</span><span class="special">&gt;</span>
    <span class="identifier">return_type</span>
    <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">T0</span><span class="special">&amp;</span> <span class="identifier">_0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

    <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T0</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">&gt;</span>
    <span class="identifier">return_type</span>
    <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">T0</span><span class="special">&amp;</span> <span class="identifier">_0</span><span class="special">,</span> <span class="identifier">T1</span><span class="special">&amp;</span> <span class="identifier">_1</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

    <span class="comment">//...</span>
<span class="special">};</span>
</pre>
<p>
      The actor class accepts the arguments through a set of function call operators
      for 0 to <code class="computeroutput"><span class="identifier">BOOST_PHOENIX_LIMIT</span></code>
      arities (Don't worry about the details, for now. Note, for example, that we
      skimp over the details regarding <code class="computeroutput"><span class="identifier">return_type</span></code>).
      The arguments are passed through to the evaluation mechanism. For more information
      see <a class="link" href="inside/actor.html" title="Actors in Detail">Inside Actors</a>.
    </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2010, 2014, 2015 Joel de Guzman, Dan Marsden, Thomas
      Heller, John Fletcher<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="organization.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="modules.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
